/*
 * Copyright 2012-2014 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.jqd.framework.core.hessian.biz.action.support;

import com.jqd.framework.core.exception.BusinessServiceException;
import com.jqd.framework.core.hessian.biz.action.ActionHandlerInterceptor;
import com.jqd.framework.core.hessian.model.ServiceRequest;
import com.jqd.framework.core.hessian.model.ServiceResponse;

/**
 * 
 * TODO
 * 
 * @author liaozhicheng.cn@gmail.com
 * @date 2012-6-11
 * @since 1.0
 */
public abstract class AbstractActionHandlerInterceptor implements ActionHandlerInterceptor, Order {
	
	@Override
	public void preHandle(ServiceRequest serviceRequest, Object handler)
			throws BusinessServiceException {
		// do nothing...
		// 仅仅提供默认实现，子类可选择性地覆盖#preHandle()或者#postHandle()再或者同时覆盖两者
	}
	
	
	@Override
	public void postHandle(ServiceRequest serviceRequest, ServiceResponse serviceResponse,
			Object handler) throws BusinessServiceException {
		// do nothing...
		// 仅仅提供默认实现，子类可选择性地覆盖#preHandle()或者#postHandle()再或者同时覆盖两者
	}
	
	// ----------------------------------------
	// implements Order
	// 用于排序，如果不配置，默认具有最高优先级
	// ----------------------------------------
	
	private int order = Order.HIGHEST_PRECEDENCE;
	
	
	public final void setOrder(int order) {
		this.order = order;
	}
	
	
	@Override
	public final int getOrder() {
		return order;
	}
	
}
